var
	a:array[1..100] of longint;
	i,n,t,p:longint;
begin
	n:=0;
	while not eoln do
	begin
		read(t);
		inc(n);
		a[n]:=t;
	end;
	read(t);
	for i:=1 to n do
		if a[i]=t then
		begin
			p:=i;
			break;
		end;
	writeln(p);
	for i:=p to n-1 do
		a[i]:=a[i+1];
	for i:=1 to n-1 do
		write(a[i],' ');
end.
